Many existing digital imaging apparatuses have a compression-encoding function for still images. As a typical one of such digital imaging apparatuses, a digital camera is known. In addition, a digital color copying machine is one of the digital imaging apparatuses with such function. In the digital color copying machine, upon transferring document image data scanned by a document scanner to a printing unit, the document scanner has a compression-encoding function for the scanned document image data so as to reduce the data size to be transferred, and the printing unit has a decompression-decoding function for the encoded document image data stream.
The encoded data size of the document image data stream encoded by the compression-encoding function of the document scanner can be reduced to a fraction of the document image data before the compression-encoding process, i.e., the data size of the scanned document image data. The upper limit of the degree of reduction of the data size of such encoded document image data stream to the document image data before the compression-encoding process, i.e., that of the compression ratio is set to be a value at which encoding distortion is not readily visually recognized from the decoded and reconstructed image. On the other hand, the allowable lower limit value of the compression ratio can be uniquely determined according to various restrictions in that system such as the maximum data size of document image data that the document scanner can scan per unit time, the maximum data transfer size of compressed-encoded data stream upon transferring data from the document scanner to the printing unit, and the like.
Even when the allowable upper and lower limit values of the compression ratio of document image data are set, it is not easy to perform a compression-encoding process to make the compression ratios of all input document image data regulate within the range specified by these upper and lower limit values. This is because even when a compression-encoding process is performed using identical encoding parameters (e.g., a quantization tables), the obtained compressed-encoded data stream have arbitrary data sizes for respective document image data stream, i.e., the compression ratio varies for respective scanned document image data.
That is, individual scanned document image data have different states and levels of deviation of their information entropy in terms of spatial frequency, and the compression-encoding process for such document image data adopts various schemes for removing redundancy of image data to be compressed (e.g., runlength encoding for a series of transformed coefficients with values “0”, and entropy encoding using variable-length codes). Therefore, in order to perform the compression-encoding process to make the compression ratios of all document image data regulate within the range between the allowable upper and lower limit values, encoding parameters to be applied to each document image data must be changed adaptively, i.e., for each image data to be compressed.
In general, in order to execute the compression-encoding process to obtain constant compression ratios, encoding control called rate control is used. As practical methods of the rate control, two schemes, i.e., a feedforward scheme and feedback scheme, are known.
In the feedforward scheme, the dynamic range, power of entropy, and various kinds of statistical values are independently calculated from source image data which is input as image data to be compressed and encoded before the compression-encoding process, so as to predict optimal encoding parameters on the basis of these calculated values, and an actual compression-encoding process is performed using the predicted encoding parameters. By contrast, in the feedback scheme, optimal encoding parameters are predicted based on the actual size of the encoded data stream obtained by executing trial compression-encoding processes, and a final compression-encoding process is performed using the predicted encoding parameters. Of these two schemes, since the feedback scheme that predicts optimal encoding parameters from the actual size of the encoded data stream obtained by trial compression-encoding processes directly uses the actually obtained size of the encoded data stream in prediction calculations, it can obtain a predicted value of encoding parameters that can be used to generate a target encoded data size with higher accuracy than the feedforward scheme. However, an extra elapsed time is consumed by trial compression-encoding processes.
In a system that allows an increase in processing time even when a compression-encoding process is repeated until an encoded data stream with a target compression ratio is obtained, i.e., a system that requires neither severe realtimeness nor higher throughput, a repetitive algorithm described in Japanese Patent Publication No. H8-32037 “Image Data Compression Apparatus” can be applied. However, a digital imaging apparatus such as a digital camera, digital color copying machine, or the like normally requires realtimeness and high-speed performance. Therefore, it is required to minimize the elapsed time consumed by trial compression-encoding processes for predicting optimal encoding parameters, and to assure higher accurate prediction result.
In order to improve the prediction accuracy of optimal encoding parameters in the rate control using the feedback scheme, it is effective to execute trial compression-encoding processes using many encoding parameters, and to obtain many references that have correspondence between these encoding parameters and actually obtained encoded data sizes. However, conventionally, in order to minimize the elapsed time, arithmetic operation circuits or processing circuits so many as the number of encoding parameters used in trial compression-encoding processes are equipped, and are parallelly operated to execute trial compression-encoding processes.
As described in reference 1 “60 to 140 Mbps compatible HDTV coding”, Video Information, January 1992, pp. 51–58, as an example of such parallel circuit scheme, N sets of quantization tables are used as a plurality of encoding parameters, a compression-encoding apparatus which comprises N quantization circuits and N generated code size measurement circuits accordingly is provided, and curve approximation is done based on N encoded data sizes obtained by this encoding apparatus to obtain an optimal set of encoding parameters, i.e., an optimal set of quantization tables.
As a devise for suppressing an increase in area of circuit although a similar arrangement is adopted, for example, Japanese Patent No. 02523953 “Encoding Apparatus” describes that three quantization circuits are equipped to parallelly execute quantization processes using five sets of quantization tables in trial compression-encoding processes, and to obtain five encoded data size values.
In video compression-encoding that adopts an encoding scheme which can sequentially execute compression-encoding processes while adaptively changing an encoding parameter (more particularly, a scaling factor for a set of quantization tables) upon compression-encoding one image data, a sequential correction algorithm described in, e.g., Japanese Patent No. 02897563 “Image Compression-encoding Apparatus”, can be applied.
In this prior art, an encoded data size for each block obtained by quantizing using a specific quantization scaling factor is calculated upon trial compression-encoding processes, M encoded data sizes which are expected to be obtained using M quantization scaling factors are predicted on the basis of the calculated data size, and the compression-encoding process is performed while sequentially correcting a quantization scaling factor which is used actually on the basis of the difference between the target encoded data size calculated from these M predicted values and the sum total of the data sizes of the encoded data stream which is actually output so far, i.e., a prediction error.
Furthermore, for the purpose of avoiding the actually generated encoded data size from exceeding the allowable upper limit value unexpectedly, as described in Japanese Patent No. 03038022 “Digital Camera Apparatus”, when the data size of an encoded data stream obtained by actually executing quantization and variable-length encoding processes using a quantization step value derived from the encoded data size obtained upon trial compression-encoding processes has exceeded the data size assigned to each block, variable-length encoding in that block is aborted (to discard information of significant transform coefficients).
The aforementioned prior arts of the rate control using the feedback scheme have common features in that an optimal encoding parameter and the predicted encoded data size generated using the encoding parameter are derived on the basis of one or a plurality of actual encoded data sizes obtained by trial compression-encoding processes.
In a JPEG encoding scheme which is prevalently adopted as a general still image compression-encoding scheme, since a quantization step matrix as one of most typical encoding parameters, i.e., a quantization table as only one combination for one image data to be compression-encoded, is commonly applied to all blocks which comprise that image data, the sequential correction algorithm of encoding parameters described in Japanese Patent No. 02897563 “Image Compression-encoding Apparatus” cannot be applied.
Furthermore, with the algorithm described in Japanese Patent No. 03038022 “Digital Camera Apparatus” cited as another prior art, when the data size assigned to each block has been exceeded, a variable-length encoding process for that block is aborted. As a result, even when the final encoded data size obtained upon completion of compression-encoding processes of all blocks that comprise image data does not exceed the allowable upper limit value, even significant transformed coefficients which need not be discarded are discarded, and local variations of compression-encoding distortion are generated in a reconstructed image obtained by a decompression-decoding process. Hence, it is not preferable to apply this algorithm to a digital imaging apparatus.
When a compression-encoding process is done while implementing rate control using the feedback scheme with high prediction accuracy in a system that requires realtimeness and higher throughput like in a digital imaging apparatus, the parallel circuit architecture described as a prior art is, in fact, effective implementation. However, a huge circuit area and buffer size are required to implement a plurality of encoding processing circuits and to temporarily store a plurality of encoded data streams, much cost is required. Hence, it is difficult to implement parallel processes using too huge circuits.
Hence, when a digital imaging apparatus adopts a still image compression-encoding scheme such as JPEG encoding which has a limited variation in encoding parameter, it is preferable to increase the number of parallel circuits within an allowable circuit area range so as to simultaneously perform compression-encoding processes using the largest possible number of different encoding parameters, and to output an encoded data stream, which suffers the minimum encoding distortion within the allowable compression ratio range, of a plurality of obtained encoded data streams.
However, since the number of parallel circuits is finite, all encoded data streams generated using a plurality of encoding parameters may fall outside the allowable compression ratio range. In such case, a new encoding parameter must be determined to redo a compression-encoding process from the head of data to be encoded. However, the time required to redo the encoding process directly leads to a performance drop of the system.
The present invention has been made in consideration of the aforementioned problems, and has as its object to compression-encode image data to a predetermined size, to suppress compression-encoding distortion of an image obtained by decompression-decoding an encoded data stream obtained by compression-encoding, and to obtain a high-quality reconstructed image.